第二次提交
#!/bin/bash

# 启动HSQLDB（增加错误处理）
(
    cd /app/demo/hsqldb && 
    nohup mvn exec:java -Dexec.mainClass="org.hsqldb.Server" -Dexec.args="-database.0 file:testdb -dbname.0 testdb" &
) || { echo "Failed to start HSQLDB"; exit 1; }

# 带超时的等待机制
timeout 30s bash -c 'until nc -z localhost 9001; do sleep 1; done' || {
    echo "Database failed to start within 30 seconds"
    exit 2
}

# 健康检查端点
echo "Application ready at $(date)" > /app/healthcheck.txt

# 保持容器运行（新增日志输出）
exec tail -f /app/healthcheck.txt
第一次提交
#!/bin/bash

# 启动HSQLDB
cd /app/demo/hsqldb
nohup mvn exec:java -Dexec.mainClass="org.hsqldb.Server" -Dexec.args="-database.0 file:testdb -dbname.0 testdb" &

# 等待数据库就绪
while ! nc -z localhost 9001; do
  sleep 1
done

# 保持容器运行
tail -f /dev/null